import { stringify } from 'qs';
import request from '../utils/request';

export async function baseUserList(params) {
  return request
    .get(`/baseuser/list?${stringify(params)}`, {
      method: 'GET',
      // params:  params ? {...params, page: params.current, size: params.pageSize } : {}
    })
    .then(e => e.data);
}
export async function baseUserList2(params) {
  return request
    .get(`/baseuser/list?${stringify(params)}`, {
      method: 'GET',
      // params:  params ? {...params, page: params.current, size: params.pageSize } : {}
    })
    .then(e => e);
}
export async function findProfile(params) {
  return request(`/baseuser/findprofile?${stringify(params)}`, {
    method: 'GET',
  });
}
export async function baseUserAdd(params) {
  return request('/baseuser/add', {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
export async function resetPassword(params) {
  return request(`/baseuser/inituserpassword?${stringify(params)}`, {
    method: 'POST',
  });
}
export async function baseUserEdit(params) {
  return request.post('/baseuser/edit', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function unbind(params) {
  return request.post('/baseuser/unbind', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function bindVehicle(params) {
  return request.post('/baseuser/bindvehicle', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function fetchBaseUserBySid(params) {
  return request(`/baseuser/findbysid/${params}`, {
    method: 'GET',
  });
}
export async function findVin(params) {
  return request(`/baseuser/findVin/${params}`, {
    method: 'GET',
  });
}
export async function fetchVehicleByUserAccountSid(params) {
  return request(`/baseuser/findVehicleByUserAccountSid/${params}`, {
    method: 'GET',
  });
}

export async function resetSecurityCode(params) {
  return request(`/baseuser/resetsecuritycode?${stringify(params)}`, {
    method: 'GET',
  });
}
